home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / I-J / If Monks had Macs....cpt / If Monks had Macs... / Journal / stack.txt < prev   
Text File  |  1992-02-09  |  28KB  |  922 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x5000 (can't delete)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2683
  12. -- card count: 2
  13. -- first card id: 3048
  14. -- list block id: 3592
  15. -- print block id: 3515
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 62976 bytes
  21. -- stack block size: 26112 bytes
  22. -- created by hypercard version: 0x01208000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01228000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x0000220000002200
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0xCC003300CC003300
  30. -- patterns[4]: 0xCC883322CC883322
  31. -- patterns[5]: 0xFF00FF00FF00FF00
  32. -- patterns[6]: 0xEECCBB33EECCBB33
  33. -- patterns[7]: 0xFFCCFF33FFCCFF33
  34. -- patterns[8]: 0xFFEEFFBBFFEEFFBB
  35. -- patterns[9]: 0xFFFFFFBBFFFFFFBB
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0xAA55AA55AA55AA55
  47. -- patterns[21]: 0x55AA55AA55AA55AA
  48. -- patterns[22]: 0x5555555555555555
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openCard
  69.   global JCard
  70.   cleanScreen
  71.   put "Sheet #" &number of this cd & " of " &number of cds into bg fld "Sheet"
  72.   put long name of this cd into JCard
  73.   if number of this cd <> 1 then
  74.     if visible of cd fld "CardInfo" of first cd is true then
  75.       hide cd fld "CardInfo" of first cd
  76.       hide bg btn "Spoiler"
  77.       put empty into cd fld "CardInfo" of first cd
  78.     end if
  79.   end if
  80. end openCard
  81.  
  82. on idle
  83.   if textFont of bg fld "Text" is "marker" then
  84.     set userLevel to 1
  85.     hide msg
  86.   else
  87.     set userLevel to 5
  88.   end if
  89.   if commandKey() is down then
  90.     cancelFindNext
  91.     show menuBar
  92.   end if
  93.   if cantmodify of this stack is true then
  94.     hide bg btn "Can¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†Modify"
  95.   end if
  96. end idle
  97.  
  98. on cleanScreen
  99.   hide menuBar
  100.   hide message
  101. end cleanScreen
  102.  
  103. on mouseDown
  104.   If "button" is not in the target then pass mouseDown
  105.   if short name of target is not "Find Next" then
  106.     cancelFindNext
  107.   end if
  108. end mouseDown
  109.  
  110. on mouseUp
  111.   if mouseV() <20 and mouseH() < 20 then
  112.     show menuBar
  113.   else
  114.     cleanScreen
  115.   end if
  116.   if "button" is not in the target then pass mouseUp
  117.   get short name of target
  118.   do it
  119. end mouseUp
  120.  
  121. on arrowkey Direction
  122.   if Direction is "left" then
  123.     visual wipe right
  124.     go prev cd
  125.   end if
  126.   if Direction is "right" then
  127.     visual wipe left
  128.     go next cd
  129.   end if
  130.   if number of this cd is 1 then
  131.     play "Harpsichord"
  132.   end if
  133.   cancelFindNext
  134. end arrowkey
  135.  
  136. on DogEar
  137.   cleanScreen
  138.   put (item 3 of rect of target) - (item 1 of clickLoc()) into x
  139.   put (item 4 of rect of target) - (item 2 of clickLoc()) into y
  140.   if (x > y) then
  141.     if optionKey() is not down then
  142.       visual wipe right
  143.       go previous cd
  144.     else
  145.       visual wipe right
  146.       go first cd
  147.     end if
  148.   else
  149.     if optionKey() is not down then
  150.       visual wipe left
  151.       go next cd
  152.     else
  153.       visual wipe left
  154.       go last cd
  155.     end if
  156.   end if
  157.   if number of this cd is 1 then
  158.     play "Harpsichord"
  159.   end if
  160.   cancelFindNext
  161.   --David Dunham's, Modified
  162.   --(Delphi:  DDUNHAM; CIS 76074,762; AppleLink D0457).
  163. end DogEar
  164.  
  165. on goBook
  166.   global ICCard
  167.   set cursor to 3
  168.   if ICCard is not empty then
  169.   else
  170.     put "first cd of stack " "e &"Imitatio Christi" "e into ICCard
  171.   end if
  172.   visual zoom in
  173.   go ICCard
  174.   if result() is empty then
  175.   else
  176.     beep
  177.     put empty into ICCard
  178.   end if
  179. end goBook
  180.  
  181. on CardInfo
  182.   global Mtemp
  183.   set cursor to 3
  184.   push cd
  185.   put "card field " "e &"CardInfo" "e  into x
  186.   get (item 2 of clickLoc() - item 2 of rect of x + scroll of x ) div textHeight of x + 1
  187.   lock screen
  188.   put line it of cd fld "CardInfo" into tester1
  189.   if tester1 is empty then
  190.     visual wipe right
  191.     pop cd
  192.   else
  193.     unlock screen
  194.     visual wipe right
  195.     go cd it
  196.   end if
  197.   hide cd fld "CardInfo" of cd 1
  198.   hide bg btn "Spoiler"
  199.   put empty into cd fld "CardInfo" of cd 1
  200.   set cantmodify of this stack to Mtemp
  201. end CardInfo
  202.  
  203. on doSpoiler
  204.   global Mtemp
  205.   visual wipe right
  206.   pop cd
  207.   hide cd fld "CardInfo" of cd 1
  208.   hide bg btn "Spoiler"
  209.   put empty into cd fld "CardInfo" of cd 1
  210.   set cantmodify of this stack to Mtemp
  211. end doSpoiler
  212.  
  213. on PAlert
  214.   answer "This journal is protected." with "Oh."
  215. end PAlert
  216. ---------------------------Find Stuff------------------------------
  217. on searchAC flag
  218.   global whichButton,whichfindbutton,textString,fType,fieldName
  219.   if textFont of bg fld "Text" is not "marker" then
  220.     if flag >0 then
  221.       put SearchAutoCat() into textString
  222.     end if
  223.     if textString is empty then exit searchAC
  224.     put ",chars,word,whole,string,date" into typeList
  225.     put item whichButton of typeList into fType
  226.     if fType is "Date" then
  227.       findDate
  228.       exit searchAC
  229.     end if
  230.     if whichFindButton contains 1 then -- search all
  231.       put empty into fieldName
  232.     end if -- wfb 1
  233.     if whichFindButton contains 2 then -- search sheet numbers
  234.       put "background field " &kwote(sheet) into fieldName
  235.     end if -- wfb 2
  236.     if whichFindButton contains 3 then -- search text field
  237.       put "background field " &kwote(text) into fieldName
  238.     end if -- wfb 3
  239.     findwks
  240.   else
  241.     PAlert
  242.   end if
  243. end searchAC
  244.  
  245. on FindWks
  246.   global FType,textString,fieldName,hits,doFind,JCard
  247.   cleanScreen
  248.   cancelFindNext
  249.   if textstring is not empty then
  250.     set cursor to 3
  251.     lock screen
  252.     push cd
  253.     set lockMessages to true
  254.     go first cd
  255.     put collectAllHits(textString,fieldname) into hits
  256.     set lockMessages to false
  257.     if hits is empty then
  258.       pop cd
  259.       put long name of this cd into JCard
  260.       unlock screen
  261.       beep
  262.       answer "Couldn't " &doFind
  263.     else
  264.       go cd (item 1 of hits)
  265.       put long name of this cd into JCard
  266.       if number of items in hits > 1 then
  267.         show bg btn "Find Next"
  268.       end if
  269.       click at 1,1
  270.       get loc of msg
  271.       set loc of msg to -1000,-1000
  272.       put doFind
  273.       hide msg
  274.       set loc of msg to it
  275.     end if
  276.     do doFind
  277.   end if
  278. end FindWks
  279.  
  280. function collectAllHits textString,fieldName
  281. global FType,doFind
  282. if fieldName is not empty then
  283.   put "find " &ftype &" " &kwote(textString) &" in " & fieldName into DoFind
  284. else
  285.   put "find " &ftype &" " &kwote(textString) into doFind
  286. end if
  287. repeat with i = 1 to 10000 --arbitrarily large number
  288.   set cursor to 3
  289.   do DoFind -- find ftype text in field fieldName
  290.   if the result is "not found" then --couldn't find it at all
  291.     return empty
  292.   else if i = 1 then --found it at least once
  293.     put id of this cd into firstFind --first time found
  294.     put firstFind into hits
  295.   else if id of this cd is firstFind then --found it some more times
  296.     --have come around to first find card
  297.     return hits
  298.   else
  299.     put "," & id of this cd after hits --add card id to the list
  300.   end if
  301.   set cursor to 3
  302.   go next cd --start looking from next card
  303. end repeat
  304. end collectAllHits
  305.  
  306. on cancelFindNext
  307.   global hits
  308.   hide bg btn "find next"
  309.   put empty into hits
  310. end cancelFindNext
  311.  
  312. function kwote string
  313. return quote & string & quote
  314. end kwote
  315.  
  316. on FindGo
  317.   global hits,currentNO,dir4
  318.   set cursor to 3
  319.   if hits is empty then
  320.   else
  321.     if hits contains id of this cd then
  322.       repeat with i = 1 to number of items of hits
  323.         if item i of hits is id of this cd then
  324.           put i into currentNO
  325.           exit repeat
  326.         end if
  327.       end repeat
  328.     end if
  329.     if dir4 is "left" then
  330.       leftGo
  331.     end if
  332.     if dir4 is "right" then
  333.       rightGo
  334.     end if
  335.   end if
  336. end FindGo
  337.  
  338. on leftGo
  339.   global hits,currentNO
  340.   visual wipe right
  341.   if first word of (item (currentNO -1) of hits) is "card" then
  342.     go (item (currentNO -1) of hits)
  343.   else
  344.     go item (number of items of hits) of hits
  345.   end if
  346. end leftGo
  347.  
  348. on rightGo
  349.   global hits,currentNO
  350.   visual wipe left
  351.   if currentNO is number of items of hits then
  352.     go item 1 of hits
  353.   else
  354.     if first word of (item (currentNO +1) of hits) is "card" then
  355.       go (item (currentNO +1) of hits)
  356.     else
  357.       go item (number of items of hits) of hits
  358.     end if
  359.   end if
  360. end rightGo
  361.  
  362. on FindDate
  363.   global textString
  364.   lock screen
  365.   put empty into temp
  366.   set cursor to 3
  367.   if textString is empty then exit FindDate
  368.   repeat with i = 1 to number of cds - 1
  369.     get bg fld "Date" of cd i
  370.     convert it to short date
  371.     if it is textString then
  372.       play "Harpsichord" "c"
  373.       unlock screen
  374.       visual effect wipe left
  375.       go cd i
  376.       put i into temp
  377.       exit FindDate
  378.     end if
  379.   end repeat
  380.   if temp is empty then
  381.     answer "A card for that date does not exist." with "Cancel"
  382.   end if
  383.   play "Harpsichord" "f"
  384. end FindDate
  385. --------------------------End Find Stuff------------------------------
  386. on PrintJournal
  387.   if textFont of bg fld "Text" is not "marker" then
  388.     push cd
  389.     Go cd 1
  390.     put cantmodify of this stack into Mtemp
  391.     set cantmodify of this stack to true
  392.     set rect of cd fld "Ref" to 82,146,381,220
  393.     set textSize of cd fld "Ref" to 14
  394.     set textAlign of cd fld "Ref" to center
  395.     put return &"Copying the text of this journal to a text file." into cd fld "Ref"
  396.     show cd fld "Ref"
  397.     lock screen
  398.     Put short name of this stack &" " &the short date into ReportName
  399.     repeat with i = 1 to number of cds
  400.       put (bg fld 2 of cd i) &return &(bg fld 3 of cd i) &return &return &(bg fld 1 of cd i) &return &return &return after temp
  401.     end repeat
  402.     Put bg fld 1 of cd 1 into temp2
  403.     put temp into bg fld 1
  404.     set name of bg fld 1 of cd 1 to ReportName
  405.     FieldToFile "bkgnd field 1","","MACA"
  406.     -- FieldToFile ¬©1988 by the Trustees of Dartmouth College.
  407.     -- FieldToFile fieldDesignation,<full pathname of file>,<creator>
  408.     set name of bg fld 1 of cd 1 to "Text"
  409.     put temp2 into bg fld 1 of cd 1
  410.     play "Harpsichord" "e"
  411.     hide cd fld "Ref"
  412.     pop cd
  413.     set cantmodify of this stack to Mtemp
  414.   else
  415.     PAlert
  416.   end if
  417. end PrintJournal
  418.  
  419. on GoHome
  420.   global leaveStack,OnceOpen
  421.   cleanScreen
  422.   set cursor to 3
  423.   put empty into leaveStack
  424.   put "Opened" into OnceOpen
  425.   if optionkey() is not down then
  426.     visual zoom in
  427.     go first cd of stack "Imitatio Christi"
  428.     if result() is empty then
  429.     else
  430.       beep
  431.       exit goHome
  432.     end if
  433.   else
  434.     answer "Go ‚ÄúHome‚Äù or Quit?"  with "Home" or "Quit" or "Cancel"
  435.     if it is "Cancel" then
  436.       exit goHome
  437.     end if
  438.     set cursor to 3
  439.     put it into leaveStack
  440.     if it is "Quit" then
  441.       if cantmodify of this stack is false then
  442.         if the freesize of this stack > 2000 and the diskspace > the size of this stack then
  443.           Answer "Straighten sheets and remove stray scraps of paper?" with "Compact" or "Next time"
  444.           If it is "Compact" then
  445.             go first cd
  446.             set rect of cd fld "Ref" to 29,146,434,203
  447.             put textSize of cd fld "Ref" into tempS
  448.             put textAlign of cd fld "Ref" into tempA
  449.             set textSize of cd fld "Ref" to 14
  450.             set textAlign of cd fld "Ref" to center
  451.             Put return &"Removing smudges, aligning sheets, and capping inkwell." into cd fld "Ref"
  452.             lock screen
  453.             show cd fld "Ref"
  454.             unlock screen with dissolve
  455.             doMenu "Compact Stack"
  456.             lock screen
  457.             hide cd fld "Ref"
  458.             unlock screen with dissolve
  459.             set textSize of cd fld "Ref" to tempS
  460.             set textAlign of cd fld "Ref" to TempA
  461.           end if
  462.         end if
  463.       end if
  464.     end if
  465.     visual zoom in
  466.     go first cd of stack "Imitatio Christi"
  467.     if result() is empty then
  468.     else
  469.       visual dissolve to grey
  470.       visual dissolve to grey
  471.       go stack "Home"
  472.     end if
  473.   end if
  474. end Gohome
  475.  
  476. on doMenu WhichItem
  477.   if whichitem is "If Monks Had Macs..." then
  478.     answer "       This stack is from the package" &return &"       ‚ÄúIf Monks Had Macs...‚Äù 2.5.7" &return &"       ¬©1988,1989  riverTEXT‚Ñ¢"
  479.     exit domenu
  480.   end if
  481.   if WhichItem is in "Quit HyperCard,New Card,Cut Card,Delete Card," &"Find...,Copy Card,Print Card,Print Stack...,Print Report...," &"Card Info..." then
  482.     if WhichItem is "Quit HyperCard" then
  483.       if the freesize of this stack > 2000 and the diskspace > the size of this stack then
  484.         Answer "Straighten sheets and remove stray scraps of paper?" with "Compact" or "Next time" or "Cancel"
  485.         if it is "Cancel" then
  486.           exit doMenu
  487.         end if
  488.         If it is "Compact" then
  489.           if cantmodify of this stack is false then
  490.             go first cd
  491.             set rect of cd fld "Ref" to 29,146,434,203
  492.             put textSize of cd fld "Ref" into tempS
  493.             put textAlign of cd fld "Ref" into tempA
  494.             set textSize of cd fld "Ref" to 14
  495.             set textAlign of cd fld "Ref" to center
  496.             Put return &"Removing smudges, aligning sheets, and capping inkwell." into cd fld "Ref"
  497.             lock screen
  498.             show cd fld "Ref"
  499.             unlock screen with dissolve
  500.             doMenu "Compact Stack"
  501.             lock screen
  502.             hide cd fld "Ref"
  503.             unlock screen with dissolve
  504.             set textSize of cd fld "Ref" to tempS
  505.             set textAlign of cd fld "Ref" to TempA
  506.           else
  507.             show menuBar
  508.             answer "The Cantmodify of this stack is set to true," &" so compacting is impossible at this time. Next session?" with "OK"
  509.             pass doMenu
  510.           end if
  511.         else
  512.           if it is "Next time" then
  513.             pass domenu
  514.           end if
  515.         end if
  516.         pass domenu
  517.       else
  518.         pass doMenu
  519.       end if
  520.     end if
  521.     if whichItem is "New Card" then
  522.       if cantmodify of this stack is false then
  523.         set cursor to 3
  524.         lock screen
  525.         go last cd of this bg
  526.         doMenu "Copy Card"
  527.         doMenu "Paste Card"
  528.         erasePage
  529.         unlock screen with wipe left
  530.         play "Harpsichord" "a"
  531.         exit doMenu
  532.       else
  533.         beep
  534.         exit doMenu
  535.       end if
  536.     end if
  537.     if whichItem is "Copy Card" then
  538.       if textFont of bg fld "Text" is  not "marker" then
  539.         pass doMenu
  540.       else
  541.         beep
  542.       end if
  543.     end if
  544.     if whichItem is in "Cut Card,Delete Card" then
  545.       if textfont of bg fld "Text" is not "marker" then
  546.         if cantmodify of this stack is false then
  547.           cleanScreen
  548.           if id of this cd is "card id 3048" then
  549.             answer "You mustn't throw away the cover sheet."
  550.             exit doMenu
  551.           end if
  552.           answer "Throw this sheet away?" with "Yes" or "No"
  553.           if it is "Yes" then
  554.             if number of cds > 2 then
  555.               set cantdelete of this cd to false
  556.               set cursor to 3
  557.               lock screen
  558.               play "Harpsichord" "b"
  559.               pass doMenu
  560.             else
  561.               beep
  562.               Answer "You mustn't throw away the last sheet of this" &" journal. Erase this entry?" with "Yes" or "No"
  563.               if it is "Yes" then
  564.                 erasePage
  565.                 play "Harpsichord" "a"
  566.               else
  567.               end if
  568.             end if
  569.           end if
  570.           exit doMenu
  571.         else
  572.           beep
  573.           answer "Deprotect the journal, please?" with "OK"
  574.           exit doMenu
  575.         end if
  576.       else
  577.         beep
  578.         answer "Remove the password protection, please?" with "OK"
  579.         exit doMenu
  580.       end if
  581.     end if
  582.     if WhichItem is in "Print Report...,Print Stack...,Print Card" then
  583.       if textFont of bg fld "Text" is not "marker" then
  584.         pass doMenu
  585.       else
  586.         answer return &"You can't print a protected journal." with "Oh."
  587.         exit doMenu
  588.       end if
  589.     end if
  590.     -- trap command-F to bring up Find dialog box
  591.     if WhichItem is "Find..." then
  592.       cleanScreen
  593.       if textFont of bg fld "Text" is not "marker" then
  594.         searchAC 1
  595.       else
  596.         beep
  597.       end if
  598.     else
  599.       pass doMenu
  600.     end if
  601.   else
  602.     pass doMenu
  603.   end if
  604. end doMenu
  605.  
  606. on erasePage
  607.   put empty into bg fld 1
  608.   put empty into bg fld 4
  609.   put the abbreviated date into bg fld "Date"
  610.   put "Sheet #" &number of this cd & " of " &number of cds into bg fld "Sheet"
  611. end erasePage
  612.  
  613. on returnKey
  614.   global doFind
  615.   if visible of msg is false then
  616.     if doFind is not empty then --continue search
  617.       set cursor to 3
  618.       do doFind
  619.     else
  620.       pass returnKey
  621.     end if
  622.   else
  623.     pass returnKey
  624.   end if
  625. end returnKey
  626. -------------------init stack-------------------
  627. on openStack
  628.   cleanScreen
  629.   if the version < 1.2 then
  630.     Answer "Hypercard version 1.2, or later, is available at your " &"Apple dealer. Many functions of this stack require the new " &"features.  Continue?" with "Risk It" or "Go Home"
  631.     if it is "Go Home" then
  632.       Eject
  633.       exit openStack
  634.     end if
  635.   end if
  636.   if textFont of bg fld "Text" is "Marker" then
  637.     Clairvauxmarker
  638.   end if
  639.   if the short date is not bg fld "ShortDate" of cd 1 then
  640.     lock screen
  641.     put cantmodify of this stack into MTemp
  642.     set cantmodify of this stack to false
  643.     get line (random of number of lines of cd fld "Quotes" of cd 1) of cd fld "Quotes" of cd 1
  644.     put "Psalms " &item 1 of it into cd fld "PsalmNumber" of cd 1
  645.     put item 2 to number of items of it of it into cd fld "Psalmquote" of cd 1
  646.     put the short date into bg fld "ShortDate" of cd 1
  647.     set cantmodify of this stack to MTemp
  648.     unlock screen with dissolve
  649.   end if
  650.   initAll  --fm Hills
  651.   About " ","If Monks had Macs..."
  652.   set userLevel to 5
  653. end openStack
  654.  
  655. on resume
  656.   initAll
  657.   pass resume
  658. end resume
  659.  
  660. on startUp
  661.   initAll
  662.   pass startUp
  663. end startUp
  664.  
  665. on initAll
  666.   global whichButton,whichFindButton,textString,doFind
  667.   global Stacks,GVMsgLoc
  668.   put empty into textString
  669.   if Stacks is empty then
  670.     CheckGlobals
  671.   end if
  672.   put loc of msg into GVMsgLoc
  673.   get line 1 of bg fld "Hold Globals" of cd 1
  674.   if it is not empty then
  675.     put line 1 of bg fld "Hold Globals" of cd 1 into whichButton
  676.     put line 2 of bg fld "Hold Globals" of cd 1 into whichFindButton
  677.     put line 3 of bg fld "Hold Globals" of cd 1 into textString
  678.     -- field remembers Find dialog box settings between stack uses
  679.   else
  680.     -- if it doesn't remember, set defaults
  681.     put 3 into whichButton
  682.     put 3 into whichFindButton
  683.     put empty into textString
  684.   end if
  685.   if textFont of bg fld "Text" is "marker" then
  686.     set loc of msg to -1000,-1000
  687.     put empty into msg
  688.     hide msg
  689.     set blindTyping to false
  690.   end if
  691. end initAll
  692.  
  693. on CheckGlobals
  694.   global GULevel,GPKeys,GTArrows
  695.   global GVPatn,GBTyping,GVMsg,GVTool
  696.   getHomeInfo
  697.   put the userLevel into GULevel
  698.   put the powerKeys Into GPKeys
  699.   put the textArrows into GTArrows
  700.   put the blindTyping into GBTyping
  701.   put the visible of the msg into GVMsg
  702.   put the visible of tool window into GVTool
  703.   put the visible of pattern window into GVPatn
  704. end CheckGlobals
  705.  
  706. on closeStack
  707.   global whichButton,whichfindbutton,textString,FType,fieldName
  708.   global doFind,hits,X1,Y1,X2,Y2,X3,Y3,dir4,currentNO
  709.   global GULevel,GPKeys,GTArrows
  710.   global GVPatn,GBTyping,GVMsg,GVTool,GVMsgLoc
  711.   cleanScreen
  712.   hide bg btn "Find Next"
  713.   if GULevel is empty then
  714.     CheckGlobals
  715.   end if
  716.   set the userLevel to GULevel
  717.   set the powerKeys to GPKeys
  718.   set the textArrows to GTArrows
  719.   set the blindTyping to GBTyping
  720.   set the visible of the msg to GVMsg
  721.   set the visible of tool window to GVTool
  722.   set the visible of pattern window to GVPatn
  723.   if char 1 of GVMsgLoc > 0 and char 1 of GVMsgLoc < 9 then
  724.     set loc of msg to GVMsgLoc
  725.   else
  726.     set loc of msg to 22,300
  727.   end if
  728.   -- record find dialog box's most recent settings
  729.   put whichButton into line 1 of bg fld "Hold Globals" of cd 1
  730.   put whichFindButton into line 2 of bg fld "Hold Globals" of cd 1
  731.   put textString into line 3 of bg fld "Hold Globals" of cd 1
  732.   if the short date is not bg fld "ShortDate" of cd 1 then
  733.     put cantmodify of this stack into MTemp
  734.     set cantmodify of this stack to false
  735.     put the short date into bg fld "ShortDate" of cd 1
  736.     set cantmodify of this stack to MTemp
  737.   end if
  738.   put "GVMsgLoc,whichButton,whichfindbutton,textString,FType,fieldName" &"doFind,hits,X1,Y1,X2,Y2,X3,Y3,dir4,currentNO" into ClearList
  739.   repeat with i = 1 to number of items of ClearList
  740.     do "put empty into " &item i of clearList
  741.   end repeat
  742.   -- if textFont of bg fld "Text" is not "marker" then
  743.   --  answer "Encrypt Journal?" with "Yes" or "No"
  744.   --  if it is "Yes" then
  745.   --    Clairvauxmarker
  746.   --  end if
  747.   --end if
  748.   about
  749. end closeStack
  750.  
  751. on Eject
  752.   set lockMessages to true
  753.   visual wipe right to black
  754.   visual dissolve
  755.   doMenu "home"
  756.   set userLevel to 5
  757. end Eject
  758.  
  759. on Clairvauxmarker
  760.   global GVMsgLoc
  761.   cleanScreen
  762.   put script of bg fld "Pword" of cd 1 into Pswd
  763.   if textFont of bg fld "Text" is "Clairvaux" then
  764.     if optionKey() is not down then
  765.       answer "Encrypt Text?" with "No" or "Yes"
  766.       if it is "No" then
  767.         exit Clairvauxmarker
  768.       end if
  769.       if it is "Yes" then
  770.         set cursor to 3
  771.         ask password "Please type your password below." &return &"(If you have forgotten your password, see your owner's manual.)"
  772.         if it is pswd then
  773.           lock screen
  774.           send mouseUp to bg btn "Can't Modify"
  775.           hide cd fld "Quotes" of first cd
  776.           set textFont of bg fld "text" to marker
  777.           set lockText of bg fld "text" to true
  778.           set textFont of cd fld "CardInfo" of cd 1 to marker
  779.           set loc of msg to -1000,-1000
  780.           put empty into msg
  781.           hide msg
  782.           set blindTyping to false
  783.           unlock screen with dissolve
  784.           send mouseUp to bg btn "Can¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†Modify"
  785.         else
  786.           beep
  787.           answer "That is not the correct password."
  788.         end if
  789.       end if
  790.       exit Clairvauxmarker
  791.     else
  792.       Ask password "What is the current password?"
  793.       if it is empty then
  794.         exit Clairvauxmarker
  795.       end if
  796.       if it is Pswd then
  797.         Ask password "What is the new password?"
  798.         if it is empty or it is "0" then
  799.           beep
  800.           exit Clairvauxmarker
  801.         end if
  802.         put it into Pswd1
  803.         ask password "Again to confirm your new password choice:"
  804.         if it is empty or it is "0"then
  805.         beep
  806.         exit Clairvauxmarker
  807.       end if
  808.       if it is Pswd1 then
  809.         set script of bg fld "Pword" of cd 1 to  Pswd1
  810.       else
  811.         beep
  812.         answer "The entries didn't match. Please try again."
  813.       end if
  814.     else
  815.       beep
  816.       answer "That is not the correct current password. Only" &" persons with the current password have permission to " &"change it." with "Oh."
  817.     end if
  818.   end if
  819.   exit Clairvauxmarker
  820. end if
  821. if textFont of bg fld "Text" is "marker" then
  822.   global tryCounter
  823.   Ask password "What is the password?"
  824.   if it is empty then
  825.     exit Clairvauxmarker
  826.   end if
  827.   if it is pswd then
  828.     set cursor to 3
  829.     lock screen
  830.     send mouseUp to bg btn "Can't Modify"
  831.     set textFont of bg fld "text" to Clairvaux
  832.     set lockText of bg fld "text" to false
  833.     set textFont of cd fld "CardInfo" of cd 1 to Clairvaux
  834.     unlock screen with dissolve
  835.     if char 1 of GVMsgLoc > 0 and char 1 of GVMsgLoc < 9 then
  836.       set loc of msg to GVMsgLoc
  837.     else
  838.       set loc of msg to 22,300
  839.     end if
  840.     put empty into tryCounter
  841.   else
  842.     put tryCounter + 1 into tryCounter
  843.     if tryCounter < 3 then
  844.       put 3 - tryCounter into triedCounter
  845.       beep
  846.       answer "Wrong Password. Authorized persons are" &return &"requested to please try again. Others are" &return &"asked not to pry.         Tries left -- " &triedCounter
  847.     else
  848.       play "Boing"
  849.       answer "Wrong password. You must not be authorized to read the journal." &return &"                                     Click here to go Home." with "I'm Sorry"
  850.       play "Boing"
  851.       Wait until the sound is "Done"
  852.       Eject
  853.       put empty into tryCounter
  854.     end if
  855.     exit Clairvauxmarker
  856.   end if
  857. end if
  858. end Clairvauxmarker
  859.  
  860. on edit
  861.   if textFont of bg fld "Text" is "Marker" then
  862.   else
  863.     pass edit
  864.   end if
  865. end edit
  866.  
  867. -- This notice is in the stack script to keep it away from snoops.
  868. -- When the Encyptor button is clicked and the text is set in the
  869. -- Marker font, the userLevel is set to Browse (no peeking at these
  870. -- instructions then by the casual viewer), the message box is hidden
  871. -- (no setting the font of the text field by typing the appropriate
  872. -- command into the message box), and the print text commands are
  873. -- intercepted (no chance that the snoop can extract a printed copy
  874. -- of your innermost secrets). (Command-shift-3 WILL export a screen
  875. -- dump, though.
  876. -- It's still possible to write a script that will begin on a card in
  877. -- another stack, open this stack, extract the text, and put it in a
  878. -- field in the other stack.
  879.  
  880. -- No claims are made that this scheme would meet NSC standards.
  881.  
  882. -- To change the password, hold down the optionKey and click on the
  883. -- Encryptor button. The password is stored in the script of a field.
  884. -- When the encryption is set, the script of the field is inaccesible
  885. -- by normal means. It is important that you write down the new pass-
  886. -- word and keep the piece of paper in a safe place. It's possible to
  887. -- retrieve the password, but it is also encrypted into an integer
  888. -- representation, not the password you have chosen for your copy of
  889. -- this stack. Please don't change the password of copies you distribute
  890. -- to others. Inform them of this notice.
  891.  
  892. -- To better protect your stack, use the built-in HC  protection scheme,
  893. -- which isn't all that foolproof, either, as there is a PD deprotector
  894. -- available.
  895.  
  896. -- Designed by
  897. -- Brian Thomas
  898. -- Scripted by
  899. -- Phillip A. Mohr Jr.
  900.  
  901. -- The list of people who deserve thanks (or blame) for the scripts
  902. -- in this stack would have to include everyone whose work is represented
  903. -- in my collection of HyperCard stacks. Since I haven't yet written the
  904. -- script that will extract a list of the names of those authors, I'll
  905. -- just offer a blanket thank you to those who see something that looks
  906. -- familiar.
  907.  
  908. -- Specific thanks go to Oscar Hills for the Find Dialog Box and XCMD,
  909. -- to David Dunham for the dogEar script, and to the Trustees of
  910. -- Dartmouth College for the FieldToFile ¬©1988 XCMDs .
  911.  
  912. -- Send comments to either:
  913. -- Philip A. Mohr, Jr, 4405 N. Rosemead Blvd.
  914. -- Suite #119, Rosemead, CA 91770
  915.  
  916. -- Brian Thomas, 13303 Waco, #67,
  917. -- Baldwin Park, CA 91706
  918.  
  919. -- Portions of this stack ¬©1988 by Philip A. Mohr, Jr. Permission is
  920. -- hereby granted for its non-commercial use and distribution.
  921.  
  922.